#ifndef DRIVER_MEMORY_H
#define DRIVER_MEMORY_H

#include "code/inc/config.h"

typedef void (*screen_poll) (void);

typedef void  (*pollscreen) (void);
typedef void  (*initscreen) (void);
typedef uint8 (*screenupdateyx) (char * ,struct t_prodevyx *);
typedef uint8 (*screenupdateyc) (char * ,struct t_prodevyc *);
typedef uint8 (*screengetyk) (struct t_prodevyk *);
typedef uint8 (*screengetpwdauth) (struct t_pwdauth *);
typedef uint8 (*screengetfilecheck) (struct t_filecheck *);
typedef void (*screenfilecheckack) (struct t_filecheckack *);
typedef uint8 (*screenfilechange) (struct t_filechange *);

struct t_screendeal
{
    pollscreen _pollscreen;
    initscreen _initscreen;
    screenupdateyx _dealscreenupdateyx;
    screenupdateyc _dealscreenupdateyc;
    screengetyk _getyaokong;
    screengetpwdauth _getpwdauth;
    screengetfilecheck _screengetfilecheck;
    screenfilecheckack _screenfilecheckack;
    screenfilechange _screenfilechange;
};

struct t_contrilmsg
{
  uint8 screenid;
  uint16 controlid;
  uint8 hide;
  uint8 value;
  char *str;
  uint8 *deal;
};
struct t_rtc//rtc信息结构体
{
     uint32 year;
     uint32 month;
     uint32 date;
     uint32 hour;
     uint32 minute;
     uint32 second;
     uint32 weekend;

     uint32 timestate;
     uint32 timesendstate;
};
void mem_setscreen(uint32 screen);

struct t_contrilmsg *memgetcontrolid(struct t_contrilmsg * buf,uint32 len,uint32 screenid,uint32 controlid);

struct t_screendeal *memgetdeal(struct t_contrilmsg * buf ,uint32 len,uint32 screenid);

void mem_showcontrol(struct t_contrilmsg *control,uint8 state);
void mem_controlenable(struct t_contrilmsg *control,uint8 enable);

void men_seticonvalue( struct t_contrilmsg *icon,uint32 value);

void button_trigger( struct t_contrilmsg *button,uint8 value);
uint8 isbutton_trigger( struct t_contrilmsg *button);

void beginrtc(struct t_contrilmsg *rtc,uint32 value);
void rtctimeout(struct t_contrilmsg *rtc);
uint8 isrtctimeout(struct t_contrilmsg *rtc);
void setrtc(int year,int month,int date,int hour,int min,int sec,int week);
void readrtc(void);

void mem_settextvalue(struct t_contrilmsg *text,char *str);
void driver_settextvalue(struct t_contrilmsg *text,char *str);
uint8 driver_gettextvalue(struct t_contrilmsg *text,char *str);
uint8 driver_texttrigger(struct t_contrilmsg *text);

uint8 mem_gettextvalue(struct t_contrilmsg *text,char *str);
void mem_cleartext(struct t_contrilmsg *text);
void mem_sendgettextvalue(struct t_contrilmsg *text);

void mem_setprogressvalue(struct t_contrilmsg *progress, uint8 value);

void mem_setqrcodevalue(struct t_contrilmsg *code,uint8 *str);

#endif

